<!DOCTYPE html>
<html lang='en'>

<head>
    <meta charset='UTF-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Document</title>
    <script src='./vue.js'></script>
    <style>
        .fade-enter-active,
        .fade-leave-active {
            transition: opacity 2s;
        }

        .fade-enter,
        .fade-leave-to {
            opacity: 0;
        }

        .fade-enter-to,
        .fade-leave {
            opacity: 1;
        }
    </style>
</head>

<body>
    <div id='app'>

        <transition name="fade">
            <div v-if="show"> {{ text }} </div>
        </transition>


        <transition name="fade">
            <div key="1"> {{ text }} </div>
        </transition>

        <input type="text" v-model="text">

        <button @click="show=!show"> 更新show </button>
    </div>
    <script>
        new Vue({
            el: '#app',
            data: {
                text: "helloworld",
                show: true
            },
            methods: {

            },
        })
    </script>
</body>

</html>